<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>编辑个人信息</title>
    <link rel="stylesheet" href="css/style.css">
    <style>
        .profile-container {
            max-width: 600px;
            margin: 20px auto;
            padding: 20px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }
        .form-group {
            margin-bottom: 15px;
        }
        .form-group label {
            display: block;
            margin-bottom: 5px;
            font-weight: bold;
        }
        .form-control {
            width: 100%;
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
        }
        .submit-btn {
            background-color: #4CAF50;
            color: white;
            padding: 10px 15px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .cancel-btn {
            background-color: #f44336;
            color: white;
            padding: 10px 15px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            text-decoration: none;
            display: inline-block;
            margin-left: 10px;
        }
        .error-msg {
            color: red;
            margin-bottom: 15px;
        }
    </style>
</head>
<body>
    <div class="profile-container">
        <h1>编辑个人信息</h1>
        <form action="/user/profile" method="post" enctype="multipart/form-data">
            <div class="form-group">
                <label for="email">邮箱:</label>
                <input type="email" id="email" name="email" value="${user.email}" class="form-control" required>
            </div>
            <div class="form-group">
                <label for="phone">电话:</label>
                <input type="tel" id="phone" name="phone" value="${user.phone}" class="form-control">
            </div>
            <div class="form-group">
                <label for="avatar">头像:</label>
                <input type="file" id="avatar" name="avatar" accept="image/*" class="form-control">
                <c:if test="${not empty user.avatar}">
                    <div class="avatar-preview">
                        <img src="${user.avatar}" alt="当前头像" style="width: 100px; height: 100px; margin-top: 10px;">
                    </div>
                </c:if>
            </div>
            <button type="submit" class="submit-btn">保存修改</button>
            <a href="/index.jsp" class="cancel-btn">取消</a>
        </form>
    </div>
</body>
</html>